<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img{
            position: absolute;
        }
    </style>
</head>
<body>
    <img src="./source/angel.gif" alt="">

    <script>
        var img = document.querySelector('img')
        //给整个页面添加事件
        document.addEventListener('mousemove',function(e){
            var x = e.pageX-50
            var y = e.pageY-40
            console.log(x);
            console.log(y);
            img.style.top = y+'px'
            img.style.left = x+'px'
        })
    </script>
</body>
</html>